import java.util.*;

public class VacationTime {
	public int bestSchedule(int N, int K, int[] workingDays) {
		ArrayList<Integer> workingdays = new ArrayList<Integer>();
		for (int i = 0; i < workingDays.length; i++)
			workingdays.add(workingDays[i]);
		int answer = N;
		for (int i = 1; i <= N - K + 1; i++) {
			int cur = 0;
			for (int j = i; j <= i + K - 1; j++) {
				if (workingdays.contains(new Integer(j)))
					cur++;
			}
			if (answer > cur)
				answer = cur;

		}
		return answer;
	}

	// BEGIN CUT HERE
	public static void main(String[] args) {
		if (args.length == 0) {
			VacationTimeHarness.run_test(-1);
		} else {
			for (int i = 0; i < args.length; ++i)
				VacationTimeHarness.run_test(Integer.valueOf(args[i]));
		}
	}
	// END CUT HERE
}

// BEGIN CUT HERE
class VacationTimeHarness {
	public static void run_test(int casenum) {
		if (casenum != -1) {
			if (runTestCase(casenum) == -1)
				System.err.println("Illegal input! Test case " + casenum
						+ " does not exist.");
			return;
		}

		int correct = 0, total = 0;
		for (int i = 0;; ++i) {
			int x = runTestCase(i);
			if (x == -1) {
				if (i >= 100)
					break;
				continue;
			}
			correct += x;
			++total;
		}

		if (total == 0) {
			System.err.println("No test cases run.");
		} else if (correct < total) {
			System.err.println("Some cases FAILED (passed " + correct + " of "
					+ total + ").");
		} else {
			System.err.println("All " + total + " tests passed!");
		}
	}

	static boolean compareOutput(int expected, int result) {
		return expected == result;
	}

	static String formatResult(int res) {
		return String.format("%d", res);
	}

	static int verifyCase(int casenum, int expected, int received) {
		System.err.print("Example " + casenum + "... ");
		if (compareOutput(expected, received)) {
			System.err.println("PASSED");
			return 1;
		} else {
			System.err.println("FAILED");
			System.err.println("    Expected: " + formatResult(expected));
			System.err.println("    Received: " + formatResult(received));
			return 0;
		}
	}

	static int runTestCase(int casenum) {
		switch (casenum) {
		case 0: {
			int N = 3;
			int K = 3;
			int[] workingDays = { 2 };
			int expected__ = 1;

			return verifyCase(casenum, expected__, new VacationTime()
					.bestSchedule(N, K, workingDays));
		}
		case 1: {
			int N = 4;
			int K = 3;
			int[] workingDays = { 3, 1, 2 };
			int expected__ = 2;

			return verifyCase(casenum, expected__, new VacationTime()
					.bestSchedule(N, K, workingDays));
		}
		case 2: {
			int N = 5;
			int K = 3;
			int[] workingDays = { 4, 1 };
			int expected__ = 1;

			return verifyCase(casenum, expected__, new VacationTime()
					.bestSchedule(N, K, workingDays));
		}
		case 3: {
			int N = 9;
			int K = 2;
			int[] workingDays = { 7, 4, 5, 6, 2 };
			int expected__ = 0;

			return verifyCase(casenum, expected__, new VacationTime()
					.bestSchedule(N, K, workingDays));
		}
		case 4: {
			int N = 1000;
			int K = 513;
			int[] workingDays = { 808, 459, 792, 863, 715, 70, 336, 731 };
			int expected__ = 2;

			return verifyCase(casenum, expected__, new VacationTime()
					.bestSchedule(N, K, workingDays));
		}

			// custom cases

			/*
			 * case 5: { int N = ; int K = ; int[] workingDays = ; int
			 * expected__ = ;
			 * 
			 * return verifyCase(casenum, expected__, new
			 * VacationTime().bestSchedule(N, K, workingDays)); }
			 */
			/*
			 * case 6: { int N = ; int K = ; int[] workingDays = ; int
			 * expected__ = ;
			 * 
			 * return verifyCase(casenum, expected__, new
			 * VacationTime().bestSchedule(N, K, workingDays)); }
			 */
			/*
			 * case 7: { int N = ; int K = ; int[] workingDays = ; int
			 * expected__ = ;
			 * 
			 * return verifyCase(casenum, expected__, new
			 * VacationTime().bestSchedule(N, K, workingDays)); }
			 */
		default:
			return -1;
		}
	}
}

// END CUT HERE
